cmake_minimum_required(VERSION 2.6)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS -g)
set(BUILD_SHARED_LIBS true)
project(AD2USB)
SET(CMAKE_SWIG_FLAGS "")
SET(SWIG_DIR "/usr/share/swig2.0")
SET(SWIG_EXECUTABLE "/usr/bin/swig2.0")
FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})

FIND_PACKAGE(PythonLibs)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH} .)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})

SET(AD2USB_SOURCES ad2usb.cpp SerialPort.cpp Parser.cpp AlarmStatus.cpp)

SET_SOURCE_FILES_PROPERTIES(ad2usb.i PROPERTIES CPLUSPLUS ON)
#SET_SOURCE_FILES_PROPERTIES(ad2usb.i PROPERTIES SWIG_FLAGS)
SWIG_ADD_MODULE(ad2usb python ad2usb.i ad2usb.h ad2usb.cpp SerialPort.cpp Parser.cpp AlarmStatus.cpp)
SWIG_LINK_LIBRARIES(ad2usb ${PYTHON_LIBRARIES})
SET(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR})


include_directories("/usr/include/python2.7" "/usr/include/tcl8.5" "build")

#add_executable (testApp ${AD2USB_SOURCES})

add_library(ad2usb ${AD2USB_SOURCES})
#add_library(ad2usb_wrap ${AD2USB_SOURCES})

enable_testing()
add_executable(alarm_parser_test
	       alarm_parser_test.cc
	       Parser.cpp
	       AlarmStatus.cpp)

target_link_libraries(alarm_parser_test
		      pthread)

target_link_libraries(alarm_parser_test
		      gtest
		      gtest_main)
add_test(parser_tests alarm_parser_test)		
